import fetch from '../index'

/* 获取个人资料 */
export const getPersonalInfo = (data) => {
  return fetch.get('/api/student/personal/information/info', data)
}
/* 设置个人资料 */
export const setPersonalInfo = (data) => {
  return fetch.post('/api/student/personal/information/set', data)
}

/* 未支付订单的个数 */
export const getOrderCunt = (data) => {
  return fetch.get('/api/student/personal/order/payCount', data)
}

/* 注销 */
export const logout = (data) => {
  return fetch.post('/api/student/logout', data)
}
/* 获取年级列表 */
export const getGradeList = (data) => {
  return fetch.get('/api/student/personal/information/gradeList', data)
}

/* 获取头像列表 */
export const getAvatarList = (data) => {
  return fetch.get('/api/student/personal/information/getDefaultAvatar', data)
}

/* 上传头像 */
export const uploadPhoto = (data) => {
  return fetch.post('/api/common/uploadFile', data)
}

/* 获取兴趣领域列表 */
export const getInterest = (data) => {
  return fetch.get('/api/student/personal/information/getInterest', data)
}

/* 修改密码 */
export const setPwds = (data) => {
  return fetch.post('/api/student/personal/account/security/resetPassword', data)
}

/* 修改手机号 */
export const setPhone = (data) => {
  return fetch.post('/api/student/personal/account/security/resetPhone', data)
}

/**
 * 订单列表
 * @param {*} data 相关参数
 * @param { String } data.type 0=待付款，1=已付款，2=已取消（交易关闭） 3=已退课 4=全部订单
 * */
export const getOrderList = (data) => {
  return fetch.get('/api/student/personal/order/list', data)
}

/* 订单详情 */
export const detail = (data) => {
  return fetch.get('/api/student/personal/order/detail', data)
}

/* 取消订单 */
export const getCancelOrder = (data) => {
  return fetch.post('/api/student/personal/order/cancel', data)
}

/* 开发票 */
export const setInvoice = (data) => {
  return fetch.post('/api/student/personal/order/invoice', data)
}

/* 申请退款详情 */
export const getNeedRefundDetail = (data) => {
  return fetch.get('/api/student/personal/order/refund/apply/detail', data)
}

/* 取消订单原因列表 */
export const getOrderReason = (data) => {
  return fetch.get('/api/student/personal/order/reason', data)
}

/* 申请退款 */
export const refundApply = (data) => {
  return fetch.post('/api/student/personal/order/refundApply', data)
}

/* 退款详情 */
export const getRefundDetail = (data) => {
  return fetch.get('/api/student/personal/order/refund/detail', data)
}

/**
 * @description 积分 花币 数量
 * @param { * } data 相关参数
 * @param { String } data.type 默认为空则查询全部 1.为收入 2.为支出
 * @param { Number } data.page 当前页码
 * @param { Number } data.per_page 每页显示多少条
 * */
export const getCoin = (data) => {
  return fetch.post('/api/student/personal/asset/integraOrHuagold', data)
}

/**
 * @description 花币 收入支出列表
 * @param { * } data 相关参数
 * @param { String } data.type 1、积分；2、花币
 * */
export const getFlowerCoin = (data) => {
  return fetch.post('/api/student/personal/asset/huagoldList', data)
}

/* 积分列表 */
export const getScore = (data) => {
  return fetch.post('/api/student/personal/asset/integralList', data)
}

/* 邀请码列表 */
export const inviteInfo = (data) => {
  return fetch.post('/api/student/personal/asset/inviteInfo', data)
}

/* 邀请记录 */
export const inviteNumber = (data) => {
  return fetch.post('/api/student/personal/asset/inviteNumber', data)
}


/**
 * 获取优惠券
 * @param {*} data 相关参数
 * @param { Number } data.type 优惠券类型 1:未使用；2已使用；3已过期；不填返回全部信息
 * @param { Number } data.page 当前页码
 * @param { Number } data.per_page 每页显示多少条
 * */
export const getCoupon = (data) => {
  return fetch.post('/api/student/personal/asset/couponList', data)
}

/* 获取优惠券 */
export const shareConfig = (data) => {
  return fetch.get('api/weChat/shareConfig', data)
}
/**
 * 获取优惠码可以使用的课程
 * @param {*} data 相关参数
 * @param { String } data.coupon_id 优惠券ID
 * @param { String } data.course_type 课程类型 1：同步课 2：专题课 3：公开课 4: 精品录播课。（不传就是全部）
 * @param { String } data.course_mode 课程模式 1.直播 2.录播 (不传就是全部)
 * @param { Number } data.page 当前页码
 * @param { Number } data.per_page 每页显示多少条
 * */
export const getCourseList = (data) => {
  return fetch.get('/api/student/personal/asset/app/coupon/courseList', data)
}

/**
 * 获取优惠券详细信息
 * @param {*} data 相关参数
 * @param { String } data.coupon_id 优惠券ID
 * */
export const getCouponInfo = (data) => {
  return fetch.get('/api/student/personal/asset/coupon/info', data)
}

/* 获取账户信息 */
export const getPhone = (data) => {
  return fetch.get('/api/student/personal/account/security/getPhone', data)
}

/* 订单修改地址 */
export const modifySite = (data) => {
  return fetch.post('/api/student/order/editShipAddress', data)
}

/* 获取物流详情 */
export const getExpress = (data) => {
  return fetch.get('/api/student/personal/order/getOrderExpress', data)
}

/**
 *  @description 广告列表
 *  @param {*} data 相关参数
 *  @param { Array } data.flag 活动类型 - 1：首页 2：开屏 3：移动首页 4：移动首页悬浮 5：移动个人中心'
 * */
export const activityAds = (data) => fetch.post('/api/activity/ads/getActivityAds', data)
